package com.jewelry.service.impl;

import java.util.List;

import com.jewelry.dao.IMaterialStoneDAO;
import com.jewelry.service.IMaterialStoneService;
import com.jewelry.service.ISeqService;
import com.jewelry.vo.MaterialStoneVO;

public class MaterialStoneServiceImpl implements IMaterialStoneService {

	private IMaterialStoneDAO materialStoneDAO;
	
	private ISeqService seqService;

	public ISeqService getSeqService() {
		return seqService;
	}

	public void setSeqService(ISeqService seqService) {
		this.seqService = seqService;
	}

	public IMaterialStoneDAO getMaterialStoneDAO() {
		return materialStoneDAO;
	}

	public void setMaterialStoneDAO(IMaterialStoneDAO materialStoneDAO) {
		this.materialStoneDAO = materialStoneDAO;
	}

	//=======================================================
	
	@Override
	public int getMaterialStoneCount(MaterialStoneVO materialStone) {
		return materialStoneDAO.getMaterialStoneCount(materialStone);
	}

	@Override
	public List<MaterialStoneVO> getMaterialStoneListByPage(
			MaterialStoneVO materialStone) {
		int totalItem = materialStoneDAO.getMaterialStoneCount(materialStone);
		materialStone.getPage().setTotalItem(totalItem);
		return materialStoneDAO.getMaterialStoneListByPage(materialStone);
	}

	@Override
	public String getMaterialStoneID() {
		return seqService.getMaterialStoneID();
	}

	@Override
	public void addMaterialStone(MaterialStoneVO materialStone) {
		materialStoneDAO.addMaterialStone(materialStone);
	}
	
}
